# Makefile DMC Win.

CC = dmc
LINK = link
LIBR = lib

# -DHAVE_ZLIB_H=1 -DPOSIX_MALLOC_THRESHOLD=10 
CFLGS = -I. -DPCRE_STATIC \
	-DPOSIX_MALLOC_THRESHOLD=0 \
	-DHAVE_INTTYPES_H=1 -DHAVE_LIMITS_H=1 \
	-DHAVE_MEMMOVE=1 -DHAVE_MEMORY_H=1 -DHAVE_STDINT_H=1 \
	-DHAVE_STRING=1 -DHAVE_STRINGS_H=1 -DHAVE_STRING_H=1 \
	-DLINK_SIZE=2 -DMATCH_LIMIT=10000000 -DMATCH_LIMIT_RECURSION=MATCH_LIMIT \
	-DMAX_NAME_COUNT=10000 -DMAX_NAME_SIZE=32 -DNEWLINE=10 \
	-DPCRE_STATIC=1 -DSUPPORT_UTF8=1 -DSUPPORT_UCP=1

LOBJS = $(patsubst %.c, %.obj, $(wildcard *.c))

ALL: pcre.lib 

%.obj: %.c 
	$(CC) $(CFLGS) -c $^ -o$@
	
pcre.lib: $(LOBJS) pcre_chartables.obj
	$(LIBR) -c $@ $^

pcre_chartables.obj: pcre_chartables.c
	$(CC) $(CFLGS) -c $^ -o$@

pcre_chartables.c: dftables.exe
	dftables.exe pcre_chartables.c

dftables.exe: addons\dftables.c
	$(CC) $(CFLGS) $^ -o$@

clean:
	del *.obj
	del *.map
	del dftables.exe pcre_chartables.c
